package com.hospital.hospitalrelay.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hospital.common.dto.SickpersonDto;
import com.hospital.common.vo.ResultEntity;
import com.hospital.hospitalrelay.entity.Sickperson;
import com.hospital.hospitalrelay.service.ISickpersonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 患者表 前端控制器
 * </p>
 *
 * @author 闫腾腾
 * @since 2020-10-21
 */
@Slf4j
@RestController
@RequestMapping("/sickperson")
public class SickpersonController {

    @Autowired
    private ISickpersonService iSickpersonService;

    //待收费列表
    @RequestMapping("/fylist")
    public ResultEntity fylist(Page page, SickpersonDto sickpersonDto){
        log.info(sickpersonDto+"@@@@@@@@@@@@@@2");
        IPage<Sickperson> fy = iSickpersonService.fylist(page,sickpersonDto);
        return ResultEntity.ok(fy);
    }

    //已收费列表
    @RequestMapping("/yslist")
    public ResultEntity yslist(Page page, SickpersonDto sickpersonDto){
        log.info(sickpersonDto+"@@@@@@@@@@@@@@2");
        IPage<Sickperson> fy = iSickpersonService.yslist(page,sickpersonDto);
        return ResultEntity.ok(fy);
    }

    //已退费列表
    @RequestMapping("/ytlist")
    public ResultEntity ytlist(Page page, SickpersonDto sickpersonDto){
        log.info(sickpersonDto+"@@@@@@@@@@@@@@2");
        IPage<Sickperson> fy = iSickpersonService.ytlist(page,sickpersonDto);
        return ResultEntity.ok(fy);
    }

    //删除
    @RequestMapping("delete")
    public boolean delete(Integer id){
        System.err.println("----------"+id);
        iSickpersonService.removeById(id);
        return true;
    }


    //编辑
    @RequestMapping("add")
    public boolean add(Sickperson sickperson){
        System.err.println("----------"+sickperson);
        iSickpersonService.save(sickperson);
        return true;
    }

}
